
const {ccclass, property} = cc._decorator;

@ccclass
export default class NewClass extends cc.Component {

    @property(cc.Label)
    label: cc.Label = null;

    @property
    text: string = 'hello';

    @property
    color:string= "#cbd3db"

    @property
    life:number= 0.2

    @property
    isActivate:boolean= true

    @property
    width:number= 10

    @property
    height:number= 10



    // LIFE-CYCLE CALLBACKS:

    onLoad () {
        this.node.color = new cc.Color().fromHEX(this.color);
    }

    start () {

    }
    resetProperties(){
        this.color = "#cbd3db";
        this.life = 0.2;
        this.isActivate = true,
        this.width = 10;
        this.height = 10;
        this.node.width = this.width;
        this.node.height = this.height;
        this.node.angle = 0;
    }

    update (dt) {

        if(!this.isActivate){
            this.life -= dt;
            if(this.node.width > 0){
                this.node.width -= dt / this.life * this.width;
            }
            
        }
        
    }
}
